home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
90%
| dexvert
| Hypertext Markup Language File (text/html)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| HTML document text
| default (weak)
| |
99%
| file
| LaTeX document text
| default
| |
98%
| file
| exported SGML document text
| default
| |
97%
| file
| exported SGML document, ASCII text
| default
| |
80%
| TrID
| HyperText Markup Language with DOCTYPE
| default
| |
19%
| TrID
| HyperText Markup Language
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| gt2
| HTML (Hyper Text Markup Language) Datei
| default
| |
100%
| detectItEasy
| Format: Plain text[LF]
| default
| |
100%
| xdgMime
| text/html
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3c 21 44 4f 43 54 59 50 | 45 20 48 54 4d 4c 20 50 |<!DOCTYP|E HTML P|
|00000010| 55 42 4c 49 43 20 22 2d | 2f 2f 57 33 43 2f 2f 44 |UBLIC "-|//W3C//D|
|00000020| 54 44 20 48 54 4d 4c 20 | 33 2e 32 20 46 69 6e 61 |TD HTML |3.2 Fina|
|00000030| 6c 2f 2f 65 6e 22 3e 0a | 0a 3c 21 2d 2d 43 6f 6e |l//en">.|.<!--Con|
|00000040| 76 65 72 74 65 64 20 77 | 69 74 68 20 4c 61 54 65 |verted w|ith LaTe|
|00000050| 58 32 48 54 4d 4c 20 32 | 30 32 32 20 28 52 65 6c |X2HTML 2|022 (Rel|
|00000060| 65 61 73 65 64 20 4a 61 | 6e 75 61 72 79 20 31 2c |eased Ja|nuary 1,|
|00000070| 20 32 30 32 32 29 20 2d | 2d 3e 0a 3c 48 54 4d 4c | 2022) -|->.<HTML|
|00000080| 20 6c 61 6e 67 3d 22 65 | 6e 22 3e 0a 3c 48 45 41 | lang="e|n">.<HEA|
|00000090| 44 3e 0a 3c 54 49 54 4c | 45 3e 43 6f 6e 74 65 6e |D>.<TITL|E>Conten|
|000000a0| 74 73 20 6f 66 20 42 61 | 73 69 63 20 43 6f 6e 63 |ts of Ba|sic Conc|
|000000b0| 65 70 74 73 3c 2f 54 49 | 54 4c 45 3e 0a 0a 3c 4d |epts</TI|TLE>..<M|
|000000c0| 45 54 41 20 48 54 54 50 | 2d 45 51 55 49 56 3d 22 |ETA HTTP|-EQUIV="|
|000000d0| 43 6f 6e 74 65 6e 74 2d | 54 79 70 65 22 20 43 4f |Content-|Type" CO|
|000000e0| 4e 54 45 4e 54 3d 22 74 | 65 78 74 2f 68 74 6d 6c |NTENT="t|ext/html|
|000000f0| 3b 20 63 68 61 72 73 65 | 74 3d 75 74 66 2d 38 22 |; charse|t=utf-8"|
|00000100| 3e 0a 3c 4d 45 54 41 20 | 4e 41 4d 45 3d 22 76 69 |>.<META |NAME="vi|
|00000110| 65 77 70 6f 72 74 22 20 | 43 4f 4e 54 45 4e 54 3d |ewport" |CONTENT=|
|00000120| 22 77 69 64 74 68 3d 64 | 65 76 69 63 65 2d 77 69 |"width=d|evice-wi|
|00000130| 64 74 68 2c 20 69 6e 69 | 74 69 61 6c 2d 73 63 61 |dth, ini|tial-sca|
|00000140| 6c 65 3d 31 2e 30 22 3e | 0a 3c 4d 45 54 41 20 4e |le=1.0">|.<META N|
|00000150| 41 4d 45 3d 22 47 65 6e | 65 72 61 74 6f 72 22 20 |AME="Gen|erator" |
|00000160| 43 4f 4e 54 45 4e 54 3d | 22 4c 61 54 65 58 32 48 |CONTENT=|"LaTeX2H|
|00000170| 54 4d 4c 20 76 32 30 32 | 32 22 3e 0a 0a 3c 4c 49 |TML v202|2">..<LI|
|00000180| 4e 4b 20 52 45 4c 3d 22 | 53 54 59 4c 45 53 48 45 |NK REL="|STYLESHE|
|00000190| 45 54 22 20 48 52 45 46 | 3d 22 69 70 63 2e 63 73 |ET" HREF|="ipc.cs|
|000001a0| 73 22 3e 0a 0a 3c 4c 49 | 4e 4b 20 52 45 4c 3d 22 |s">..<LI|NK REL="|
|000001b0| 6e 65 78 74 22 20 48 52 | 45 46 3d 22 6e 6f 64 65 |next" HR|EF="node|
|000001c0| 35 5f 6d 6e 2e 68 74 6d | 6c 22 3e 0a 3c 4c 49 4e |5_mn.htm|l">.<LIN|
|000001d0| 4b 20 52 45 4c 3d 22 70 | 72 65 76 69 6f 75 73 22 |K REL="p|revious"|
|000001e0| 20 48 52 45 46 3d 22 6e | 6f 64 65 33 5f 6d 6e 2e | HREF="n|ode3_mn.|
|000001f0| 68 74 6d 6c 22 3e 0a 3c | 4c 49 4e 4b 20 52 45 4c |html">.<|LINK REL|
|00000200| 3d 22 75 70 22 20 48 52 | 45 46 3d 22 6e 6f 64 65 |="up" HR|EF="node|
|00000210| 33 5f 6d 6e 2e 68 74 6d | 6c 22 3e 0a 3c 4c 49 4e |3_mn.htm|l">.<LIN|
|00000220| 4b 20 52 45 4c 3d 22 6e | 65 78 74 22 20 48 52 45 |K REL="n|ext" HRE|
|00000230| 46 3d 22 6e 6f 64 65 35 | 5f 6d 6e 2e 68 74 6d 6c |F="node5|_mn.html|
|00000240| 22 3e 0a 3c 2f 48 45 41 | 44 3e 0a 20 0a 3c 42 4f |">.</HEA|D>. .<BO|
|00000250| 44 59 20 62 67 63 6f 6c | 6f 72 3d 22 23 66 66 66 |DY bgcol|or="#fff|
|00000260| 66 66 66 22 20 74 65 78 | 74 3d 22 23 30 30 30 30 |fff" tex|t="#0000|
|00000270| 30 30 22 20 6c 69 6e 6b | 3d 22 23 39 39 34 34 45 |00" link|="#9944E|
|00000280| 45 22 20 76 6c 69 6e 6b | 3d 22 23 30 30 30 30 66 |E" vlink|="#0000f|
|00000290| 66 22 20 61 6c 69 6e 6b | 3d 22 23 30 30 66 66 30 |f" alink|="#00ff0|
|000002a0| 30 22 3e 0a 0a 3c 48 32 | 3e 3c 41 20 49 44 3d 22 |0">..<H2|><A ID="|
|000002b0| 53 45 43 54 49 4f 4e 30 | 30 31 32 31 30 30 30 30 |SECTION0|01210000|
|000002c0| 30 30 30 30 30 30 30 30 | 30 30 30 22 3e 0a 42 61 |00000000|000">.Ba|
|000002d0| 73 69 63 20 43 6f 6e 63 | 65 70 74 73 3c 2f 41 3e |sic Conc|epts</A>|
|000002e0| 0a 3c 2f 48 32 3e 0a 0a | 3c 50 3e 0a 53 69 6d 70 |.</H2>..|<P>.Simp|
|000002f0| 6c 79 20 70 75 74 2c 20 | 61 20 3c 45 4d 3e 70 69 |ly put, |a <EM>pi|
|00000300| 70 65 3c 2f 45 4d 3e 20 | 69 73 20 61 20 6d 65 74 |pe</EM> |is a met|
|00000310| 68 6f 64 20 6f 66 20 63 | 6f 6e 6e 65 63 74 69 6e |hod of c|onnectin|
|00000320| 67 20 74 68 65 20 3c 45 | 4d 3e 73 74 61 6e 64 61 |g the <E|M>standa|
|00000330| 72 64 20 6f 75 74 70 75 | 74 3c 2f 45 4d 3e 20 6f |rd outpu|t</EM> o|
|00000340| 66 20 6f 6e 65 0a 70 72 | 6f 63 65 73 73 20 74 6f |f one.pr|ocess to|
|00000350| 20 74 68 65 20 3c 45 4d | 3e 73 74 61 6e 64 61 72 | the <EM|>standar|
|00000360| 64 20 69 6e 70 75 74 3c | 2f 45 4d 3e 20 6f 66 20 |d input<|/EM> of |
|00000370| 61 6e 6f 74 68 65 72 2e | 20 20 50 69 70 65 73 20 |another.| Pipes |
|00000380| 61 72 65 20 74 68 65 20 | 65 6c 64 65 73 74 20 6f |are the |eldest o|
|00000390| 66 20 74 68 65 20 49 50 | 43 0a 74 6f 6f 6c 73 2c |f the IP|C.tools,|
|000003a0| 20 68 61 76 69 6e 67 20 | 62 65 65 6e 20 61 72 6f | having |been aro|
|000003b0| 75 6e 64 20 73 69 6e 63 | 65 20 74 68 65 20 65 61 |und sinc|e the ea|
|000003c0| 72 6c 69 65 73 74 20 69 | 6e 63 61 72 6e 61 74 69 |rliest i|ncarnati|
|000003d0| 6f 6e 73 20 6f 66 20 74 | 68 65 20 55 4e 49 58 0a |ons of t|he UNIX.|
|000003e0| 6f 70 65 72 61 74 69 6e | 67 20 73 79 73 74 65 6d |operatin|g system|
|000003f0| 2e 20 20 54 68 65 79 20 | 70 72 6f 76 69 64 65 20 |. They |provide |
|00000400| 61 20 6d 65 74 68 6f 64 | 20 6f 66 20 6f 6e 65 2d |a method| of one-|
|00000410| 77 61 79 20 63 6f 6d 6d | 75 6e 69 63 61 74 69 6f |way comm|unicatio|
|00000420| 6e 73 20 28 68 65 6e 63 | 65 0a 74 68 65 20 74 65 |ns (henc|e.the te|
|00000430| 72 6d 20 68 61 6c 66 2d | 64 75 70 6c 65 78 29 20 |rm half-|duplex) |
|00000440| 62 65 74 77 65 65 6e 20 | 70 72 6f 63 65 73 73 65 |between |processe|
|00000450| 73 2e 0a 0a 3c 50 3e 0a | 54 68 69 73 20 66 65 61 |s...<P>.|This fea|
|00000460| 74 75 72 65 20 69 73 20 | 77 69 64 65 6c 79 20 75 |ture is |widely u|
|00000470| 73 65 64 2c 20 65 76 65 | 6e 20 6f 6e 20 74 68 65 |sed, eve|n on the|
|00000480| 20 55 4e 49 58 20 63 6f | 6d 6d 61 6e 64 20 6c 69 | UNIX co|mmand li|
|00000490| 6e 65 20 28 69 6e 20 74 | 68 65 20 73 68 65 6c 6c |ne (in t|he shell|
|000004a0| 29 2e 0a 0a 3c 50 3e 0a | 3c 42 52 3e 0a 3c 49 4d |)...<P>.|<BR>.<IM|
|000004b0| 47 0a 20 20 53 54 59 4c | 45 3d 22 22 20 53 52 43 |G. STYL|E="" SRC|
|000004c0| 3d 22 69 6d 67 31 2e 70 | 6e 67 22 0a 20 41 4c 54 |="img1.p|ng". ALT|
|000004d0| 3d 22 5c 62 65 67 69 6e | 7b 74 73 63 72 65 65 6e |="\begin|{tscreen|
|000004e0| 7d 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |}.\begin|{verbati|
|000004f0| 6d 7d 6c 73 20 5c 76 65 | 72 74 20 73 6f 72 74 20 |m}ls \ve|rt sort |
|00000500| 5c 76 65 72 74 20 6c 70 | 5c 65 6e 64 7b 76 65 72 |\vert lp|\end{ver|
|00000510| 62 61 74 69 6d 7d 0a 5c | 70 61 72 0a 5c 65 6e 64 |batim}.\|par.\end|
|00000520| 7b 74 73 63 72 65 65 6e | 7d 22 3e 0a 3c 42 52 3e |{tscreen|}">.<BR>|
|00000530| 0a 0a 3c 50 3e 0a 54 68 | 65 20 61 62 6f 76 65 20 |..<P>.Th|e above |
|00000540| 73 65 74 73 20 75 70 20 | 61 20 70 69 70 65 6c 69 |sets up |a pipeli|
|00000550| 6e 65 2c 20 74 61 6b 69 | 6e 67 20 74 68 65 20 6f |ne, taki|ng the o|
|00000560| 75 74 70 75 74 20 6f 66 | 20 6c 73 20 61 73 20 74 |utput of| ls as t|
|00000570| 68 65 20 69 6e 70 75 74 | 20 6f 66 20 0a 73 6f 72 |he input| of .sor|
|00000580| 74 2c 20 61 6e 64 20 74 | 68 65 20 6f 75 74 70 75 |t, and t|he outpu|
|00000590| 74 20 6f 66 20 73 6f 72 | 74 20 61 73 20 74 68 65 |t of sor|t as the|
|000005a0| 20 69 6e 70 75 74 20 6f | 66 20 6c 70 2e 20 20 54 | input o|f lp. T|
|000005b0| 68 65 20 64 61 74 61 20 | 69 73 20 72 75 6e 6e 69 |he data |is runni|
|000005c0| 6e 67 20 74 68 72 6f 75 | 67 68 20 61 0a 68 61 6c |ng throu|gh a.hal|
|000005d0| 66 20 64 75 70 6c 65 78 | 20 70 69 70 65 2c 20 74 |f duplex| pipe, t|
|000005e0| 72 61 76 65 6c 69 6e 67 | 20 28 76 69 73 75 61 6c |raveling| (visual|
|000005f0| 6c 79 29 20 6c 65 66 74 | 20 74 6f 20 72 69 67 68 |ly) left| to righ|
|00000600| 74 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 70 69 |t throug|h the pi|
|00000610| 70 65 6c 69 6e 65 2e 0a | 0a 3c 50 3e 0a 41 6c 74 |peline..|.<P>.Alt|
|00000620| 68 6f 75 67 68 20 6d 6f | 73 74 20 6f 66 20 75 73 |hough mo|st of us|
|00000630| 20 75 73 65 20 70 69 70 | 65 73 20 71 75 69 74 65 | use pip|es quite|
|00000640| 20 72 65 6c 69 67 69 6f | 75 73 6c 79 20 69 6e 20 | religio|usly in |
|00000650| 73 68 65 6c 6c 20 73 63 | 72 69 70 74 20 70 72 6f |shell sc|ript pro|
|00000660| 67 72 61 6d 6d 69 6e 67 | 2c 20 0a 77 65 20 6f 66 |gramming|, .we of|
|00000670| 74 65 6e 20 64 6f 20 73 | 6f 20 77 69 74 68 6f 75 |ten do s|o withou|
|00000680| 74 20 67 69 76 69 6e 67 | 20 61 20 73 65 63 6f 6e |t giving| a secon|
|00000690| 64 20 74 68 6f 75 67 68 | 74 20 74 6f 20 77 68 61 |d though|t to wha|
|000006a0| 74 20 74 72 61 6e 73 70 | 69 72 65 73 20 61 74 20 |t transp|ires at |
|000006b0| 74 68 65 20 6b 65 72 6e | 65 6c 0a 6c 65 76 65 6c |the kern|el.level|
|000006c0| 2e 20 0a 0a 3c 50 3e 0a | 57 68 65 6e 20 61 20 70 |. ..<P>.|When a p|
|000006d0| 72 6f 63 65 73 73 20 63 | 72 65 61 74 65 73 20 61 |rocess c|reates a|
|000006e0| 20 70 69 70 65 2c 20 74 | 68 65 20 6b 65 72 6e 65 | pipe, t|he kerne|
|000006f0| 6c 20 73 65 74 73 20 75 | 70 20 74 77 6f 20 66 69 |l sets u|p two fi|
|00000700| 6c 65 20 64 65 73 63 72 | 69 70 74 6f 72 73 20 66 |le descr|iptors f|
|00000710| 6f 72 20 75 73 65 0a 62 | 79 20 74 68 65 20 70 69 |or use.b|y the pi|
|00000720| 70 65 2e 20 20 4f 6e 65 | 20 64 65 73 63 72 69 70 |pe. One| descrip|
|00000730| 74 6f 72 20 69 73 20 75 | 73 65 64 20 74 6f 20 61 |tor is u|sed to a|
|00000740| 6c 6c 6f 77 20 61 20 70 | 61 74 68 20 6f 66 20 69 |llow a p|ath of i|
|00000750| 6e 70 75 74 20 69 6e 74 | 6f 20 74 68 65 20 70 69 |nput int|o the pi|
|00000760| 70 65 20 28 77 72 69 74 | 65 29 2c 0a 77 68 69 6c |pe (writ|e),.whil|
|00000770| 65 20 74 68 65 20 6f 74 | 68 65 72 20 69 73 20 75 |e the ot|her is u|
|00000780| 73 65 64 20 74 6f 20 6f | 62 74 61 69 6e 20 64 61 |sed to o|btain da|
|00000790| 74 61 20 66 72 6f 6d 20 | 74 68 65 20 70 69 70 65 |ta from |the pipe|
|000007a0| 20 28 72 65 61 64 29 2e | 20 20 41 74 20 74 68 69 | (read).| At thi|
|000007b0| 73 20 70 6f 69 6e 74 2c | 20 74 68 65 0a 70 69 70 |s point,| the.pip|
|000007c0| 65 20 69 73 20 6f 66 20 | 6c 69 74 74 6c 65 20 70 |e is of |little p|
|000007d0| 72 61 63 74 69 63 61 6c | 20 75 73 65 2c 20 61 73 |ractical| use, as|
|000007e0| 20 74 68 65 20 63 72 65 | 61 74 69 6e 67 20 70 72 | the cre|ating pr|
|000007f0| 6f 63 65 73 73 20 63 61 | 6e 20 6f 6e 6c 79 20 75 |ocess ca|n only u|
|00000800| 73 65 20 74 68 65 20 70 | 69 70 65 20 74 6f 0a 63 |se the p|ipe to.c|
|00000810| 6f 6d 6d 75 6e 69 63 61 | 74 65 20 77 69 74 68 20 |ommunica|te with |
|00000820| 69 74 73 65 6c 66 2e 20 | 20 43 6f 6e 73 69 64 65 |itself. | Conside|
|00000830| 72 20 74 68 69 73 20 72 | 65 70 72 65 73 65 6e 74 |r this r|epresent|
|00000840| 61 74 69 6f 6e 20 6f 66 | 20 61 20 70 72 6f 63 65 |ation of| a proce|
|00000850| 73 73 20 61 6e 64 20 74 | 68 65 0a 6b 65 72 6e 65 |ss and t|he.kerne|
|00000860| 6c 20 61 66 74 65 72 20 | 61 20 70 69 70 65 20 68 |l after |a pipe h|
|00000870| 61 73 20 62 65 65 6e 20 | 63 72 65 61 74 65 64 3a |as been |created:|
|00000880| 0a 0a 3c 50 3e 0a 3c 44 | 49 56 20 63 6c 61 73 73 |..<P>.<D|IV class|
|00000890| 3d 22 43 45 4e 54 45 52 | 22 3e 0a 0a 0a 3c 42 52 |="CENTER|">...<BR|
|000008a0| 3e 0a 3c 49 4d 47 0a 20 | 20 53 54 59 4c 45 3d 22 |>.<IMG. | STYLE="|
|000008b0| 68 65 69 67 68 74 3a 20 | 31 39 36 2e 32 35 65 78 |height: |196.25ex|
|000008c0| 3b 20 76 65 72 74 69 63 | 61 6c 2d 61 6c 69 67 6e |; vertic|al-align|
|000008d0| 3a 20 2d 30 2e 31 32 65 | 78 3b 20 22 20 53 52 43 |: -0.12e|x; " SRC|
|000008e0| 3d 22 69 6d 67 32 2e 70 | 6e 67 22 0a 20 41 4c 54 |="img2.p|ng". ALT|
|000008f0| 3d 22 5c 62 65 67 69 6e | 7b 70 69 63 74 75 72 65 |="\begin|{picture|
|00000900| 7d 28 38 39 34 2c 32 35 | 34 29 0a 5c 70 75 74 28 |}(894,25|4).\put(|
|00000910| 35 35 38 2c 32 35 30 29 | 7b 5c 72 75 6c 65 7b 33 |558,250)|{\rule{3|
|00000920| 30 34 5c 75 6e 69 74 6c | 65 6e 67 74 68 7d 7b 32 |04\unitl|ength}{2|
|00000930| 5c 75 6e 69 74 6c 65 6e | 67 74 68 7d 7d 0a 5c 70 |\unitlen|gth}}.\p|
|00000940| 75 74 2e 2e 2e 0a 2e 2e | 2e 74 68 7d 7b 32 5c 75 |ut......|.th}{2\u|
|00000950| 6e 69 74 6c 65 6e 67 74 | 68 7d 7d 0a 5c 70 75 74 |nitlengt|h}}.\put|
|00000960| 28 33 38 2c 36 29 7b 5c | 72 75 6c 65 7b 33 30 34 |(38,6){\|rule{304|
|00000970| 5c 75 6e 69 74 6c 65 6e | 67 74 68 7d 7b 32 5c 75 |\unitlen|gth}{2\u|
|00000980| 6e 69 74 6c 65 6e 67 74 | 68 7d 7d 0a 5c 65 6e 64 |nitlengt|h}}.\end|
|00000990| 7b 70 69 63 74 75 72 65 | 7d 22 3e 0a 3c 42 52 3e |{picture|}">.<BR>|
|000009a0| 0a 3c 2f 44 49 56 3e 0a | 3c 50 3e 0a 3c 44 49 56 |.</DIV>.|<P>.<DIV|
|000009b0| 20 63 6c 61 73 73 3d 22 | 43 45 4e 54 45 52 22 3e | class="|CENTER">|
|000009c0| 0a 0a 3c 2f 44 49 56 3e | 0a 0a 3c 50 3e 0a 46 72 |..</DIV>|..<P>.Fr|
|000009d0| 6f 6d 20 74 68 65 20 61 | 62 6f 76 65 20 64 69 61 |om the a|bove dia|
|000009e0| 67 72 61 6d 2c 20 69 74 | 20 69 73 20 65 61 73 79 |gram, it| is easy|
|000009f0| 20 74 6f 20 73 65 65 20 | 68 6f 77 20 74 68 65 20 | to see |how the |
|00000a00| 64 65 73 63 72 69 70 74 | 6f 72 73 20 61 72 65 20 |descript|ors are |
|00000a10| 63 6f 6e 6e 65 63 74 65 | 64 0a 74 6f 67 65 74 68 |connecte|d.togeth|
|00000a20| 65 72 2e 20 20 49 66 20 | 74 68 65 20 70 72 6f 63 |er. If |the proc|
|00000a30| 65 73 73 20 73 65 6e 64 | 73 20 64 61 74 61 20 74 |ess send|s data t|
|00000a40| 68 72 6f 75 67 68 20 74 | 68 65 20 70 69 70 65 20 |hrough t|he pipe |
|00000a50| 28 66 64 30 29 2c 20 69 | 74 20 68 61 73 20 74 68 |(fd0), i|t has th|
|00000a60| 65 20 61 62 69 6c 69 74 | 79 0a 74 6f 20 6f 62 74 |e abilit|y.to obt|
|00000a70| 61 69 6e 20 28 72 65 61 | 64 29 20 74 68 61 74 20 |ain (rea|d) that |
|00000a80| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 66 72 6f 6d |informat|ion from|
|00000a90| 20 66 64 31 2e 20 20 48 | 6f 77 65 76 65 72 2c 20 | fd1. H|owever, |
|00000aa0| 74 68 65 72 65 20 69 73 | 20 61 20 6d 75 63 68 20 |there is| a much |
|00000ab0| 6c 61 72 67 65 72 0a 6f | 62 6a 65 63 74 69 76 65 |larger.o|bjective|
|00000ac0| 20 6f 66 20 74 68 65 20 | 73 69 6d 70 6c 69 73 74 | of the |simplist|
|00000ad0| 69 63 20 73 6b 65 74 63 | 68 20 61 62 6f 76 65 2e |ic sketc|h above.|
|00000ae0| 20 20 57 68 69 6c 65 20 | 61 20 70 69 70 65 20 69 | While |a pipe i|
|00000af0| 6e 69 74 69 61 6c 6c 79 | 20 63 6f 6e 6e 65 63 74 |nitially| connect|
|00000b00| 73 20 61 20 0a 70 72 6f | 63 65 73 73 20 74 6f 20 |s a .pro|cess to |
|00000b10| 69 74 73 65 6c 66 2c 20 | 64 61 74 61 20 74 72 61 |itself, |data tra|
|00000b20| 76 65 6c 69 6e 67 20 74 | 68 72 6f 75 67 68 20 74 |veling t|hrough t|
|00000b30| 68 65 20 70 69 70 65 20 | 6d 6f 76 65 73 20 74 68 |he pipe |moves th|
|00000b40| 72 6f 75 67 68 20 74 68 | 65 20 6b 65 72 6e 65 6c |rough th|e kernel|
|00000b50| 2e 0a 55 6e 64 65 72 20 | 4c 69 6e 75 78 2c 20 69 |..Under |Linux, i|
|00000b60| 6e 20 70 61 72 74 69 63 | 75 6c 61 72 2c 20 70 69 |n partic|ular, pi|
|00000b70| 70 65 73 20 61 72 65 20 | 61 63 74 75 61 6c 6c 79 |pes are |actually|
|00000b80| 20 72 65 70 72 65 73 65 | 6e 74 65 64 20 69 6e 74 | represe|nted int|
|00000b90| 65 72 6e 61 6c 6c 79 20 | 77 69 74 68 20 61 0a 76 |ernally |with a.v|
|00000ba0| 61 6c 69 64 20 69 6e 6f | 64 65 2e 20 20 4f 66 20 |alid ino|de. Of |
|00000bb0| 63 6f 75 72 73 65 2c 20 | 74 68 69 73 20 69 6e 6f |course, |this ino|
|00000bc0| 64 65 20 72 65 73 69 64 | 65 73 20 77 69 74 68 69 |de resid|es withi|
|00000bd0| 6e 20 74 68 65 20 6b 65 | 72 6e 65 6c 20 69 74 73 |n the ke|rnel its|
|00000be0| 65 6c 66 2c 20 61 6e 64 | 20 6e 6f 74 0a 77 69 74 |elf, and| not.wit|
|00000bf0| 68 69 6e 20 74 68 65 20 | 62 6f 75 6e 64 73 20 6f |hin the |bounds o|
|00000c00| 66 20 61 6e 79 20 70 68 | 79 73 69 63 61 6c 20 66 |f any ph|ysical f|
|00000c10| 69 6c 65 20 73 79 73 74 | 65 6d 2e 20 20 54 68 69 |ile syst|em. Thi|
|00000c20| 73 20 70 61 72 74 69 63 | 75 6c 61 72 20 70 6f 69 |s partic|ular poi|
|00000c30| 6e 74 20 77 69 6c 6c 0a | 6f 70 65 6e 20 75 70 20 |nt will.|open up |
|00000c40| 73 6f 6d 65 20 70 72 65 | 74 74 79 20 68 61 6e 64 |some pre|tty hand|
|00000c50| 79 20 49 2f 4f 20 64 6f | 6f 72 73 20 66 6f 72 20 |y I/O do|ors for |
|00000c60| 75 73 2c 20 61 73 20 77 | 65 20 77 69 6c 6c 20 73 |us, as w|e will s|
|00000c70| 65 65 20 61 20 62 69 74 | 20 6c 61 74 65 72 20 6f |ee a bit| later o|
|00000c80| 6e 2e 0a 0a 3c 50 3e 0a | 41 74 20 74 68 69 73 20 |n...<P>.|At this |
|00000c90| 70 6f 69 6e 74 2c 20 74 | 68 65 20 70 69 70 65 20 |point, t|he pipe |
|00000ca0| 69 73 20 66 61 69 72 6c | 79 20 75 73 65 6c 65 73 |is fairl|y useles|
|00000cb0| 73 2e 20 20 41 66 74 65 | 72 20 61 6c 6c 2c 20 77 |s. Afte|r all, w|
|00000cc0| 68 79 20 67 6f 20 74 6f | 20 74 68 65 20 74 72 6f |hy go to| the tro|
|00000cd0| 75 62 6c 65 20 6f 66 0a | 63 72 65 61 74 69 6e 67 |uble of.|creating|
|00000ce0| 20 61 20 70 69 70 65 20 | 69 66 20 77 65 20 61 72 | a pipe |if we ar|
|00000cf0| 65 20 6f 6e 6c 79 20 67 | 6f 69 6e 67 20 74 6f 20 |e only g|oing to |
|00000d00| 74 61 6c 6b 20 74 6f 20 | 6f 75 72 73 65 6c 66 3f |talk to |ourself?|
|00000d10| 20 20 41 74 20 74 68 69 | 73 20 70 6f 69 6e 74 2c | At thi|s point,|
|00000d20| 20 74 68 65 20 0a 63 72 | 65 61 74 69 6e 67 20 70 | the .cr|eating p|
|00000d30| 72 6f 63 65 73 73 20 74 | 79 70 69 63 61 6c 6c 79 |rocess t|ypically|
|00000d40| 20 66 6f 72 6b 73 20 61 | 20 63 68 69 6c 64 20 70 | forks a| child p|
|00000d50| 72 6f 63 65 73 73 2e 20 | 20 53 69 6e 63 65 20 61 |rocess. | Since a|
|00000d60| 20 63 68 69 6c 64 20 70 | 72 6f 63 65 73 73 20 77 | child p|rocess w|
|00000d70| 69 6c 6c 0a 69 6e 68 65 | 72 69 74 20 61 6e 79 20 |ill.inhe|rit any |
|00000d80| 6f 70 65 6e 20 66 69 6c | 65 20 64 65 73 63 72 69 |open fil|e descri|
|00000d90| 70 74 6f 72 73 20 66 72 | 6f 6d 20 74 68 65 20 70 |ptors fr|om the p|
|00000da0| 61 72 65 6e 74 2c 20 77 | 65 20 6e 6f 77 20 68 61 |arent, w|e now ha|
|00000db0| 76 65 20 74 68 65 20 62 | 61 73 69 73 20 66 6f 72 |ve the b|asis for|
|00000dc0| 0a 6d 75 6c 74 69 70 72 | 6f 63 65 73 73 20 63 6f |.multipr|ocess co|
|00000dd0| 6d 6d 75 6e 69 63 61 74 | 69 6f 6e 20 28 62 65 74 |mmunicat|ion (bet|
|00000de0| 77 65 65 6e 20 70 61 72 | 65 6e 74 20 61 6e 64 20 |ween par|ent and |
|00000df0| 63 68 69 6c 64 29 2e 20 | 20 43 6f 6e 73 69 64 65 |child). | Conside|
|00000e00| 72 20 74 68 69 73 20 75 | 70 64 61 74 65 64 0a 76 |r this u|pdated.v|
|00000e10| 65 72 73 69 6f 6e 20 6f | 66 20 6f 75 72 20 73 69 |ersion o|f our si|
|00000e20| 6d 70 6c 65 20 73 6b 65 | 74 63 68 3a 0a 0a 3c 50 |mple ske|tch:..<P|
|00000e30| 3e 0a 3c 44 49 56 20 63 | 6c 61 73 73 3d 22 43 45 |>.<DIV c|lass="CE|
|00000e40| 4e 54 45 52 22 3e 0a 0a | 0a 3c 42 52 3e 0a 3c 49 |NTER">..|.<BR>.<I|
|00000e50| 4d 47 0a 20 20 53 54 59 | 4c 45 3d 22 68 65 69 67 |MG. STY|LE="heig|
|00000e60| 68 74 3a 20 32 34 2e 34 | 38 65 78 3b 20 76 65 72 |ht: 24.4|8ex; ver|
|00000e70| 74 69 63 61 6c 2d 61 6c | 69 67 6e 3a 20 31 35 34 |tical-al|ign: 154|
|00000e80| 2e 36 31 65 78 3b 20 22 | 20 53 52 43 3d 22 69 6d |.61ex; "| SRC="im|
|00000e90| 67 33 2e 70 6e 67 22 0a | 20 41 4c 54 3d 22 5c 62 |g3.png".| ALT="\b|
|00000ea0| 65 67 69 6e 7b 70 69 63 | 74 75 72 65 7d 28 31 30 |egin{pic|ture}(10|
|00000eb0| 32 34 2c 32 35 36 29 0a | 5c 70 75 74 28 34 30 35 |24,256).|\put(405|
|00000ec0| 2c 32 34 38 29 7b 5c 72 | 75 6c 65 7b 32 32 34 5c |,248){\r|ule{224\|
|00000ed0| 75 6e 69 74 6c 65 6e 67 | 74 68 7d 7b 32 5c 75 6e |unitleng|th}{2\un|
|00000ee0| 69 74 6c 65 6e 67 74 68 | 7d 7d 0a 5c 70 75 2e 2e |itlength|}}.\pu..|
|00000ef0| 2e 0a 2e 2e 2e 74 68 7d | 7b 32 5c 75 6e 69 74 6c |.....th}|{2\unitl|
|00000f00| 65 6e 67 74 68 7d 7d 0a | 5c 70 75 74 28 32 31 2c |ength}}.|\put(21,|
|00000f10| 34 29 7b 5c 72 75 6c 65 | 7b 32 32 34 5c 75 6e 69 |4){\rule|{224\uni|
|00000f20| 74 6c 65 6e 67 74 68 7d | 7b 32 5c 75 6e 69 74 6c |tlength}|{2\unitl|
|00000f30| 65 6e 67 74 68 7d 7d 0a | 5c 65 6e 64 7b 70 69 63 |ength}}.|\end{pic|
|00000f40| 74 75 72 65 7d 22 3e 0a | 3c 42 52 3e 0a 3c 2f 44 |ture}">.|<BR>.</D|
|00000f50| 49 56 3e 0a 3c 50 3e 0a | 3c 44 49 56 20 63 6c 61 |IV>.<P>.|<DIV cla|
|00000f60| 73 73 3d 22 43 45 4e 54 | 45 52 22 3e 0a 3c 2f 44 |ss="CENT|ER">.</D|
|00000f70| 49 56 3e 0a 3c 50 3e 0a | 3c 44 49 56 20 63 6c 61 |IV>.<P>.|<DIV cla|
|00000f80| 73 73 3d 22 43 45 4e 54 | 45 52 22 3e 0a 3c 2f 44 |ss="CENT|ER">.</D|
|00000f90| 49 56 3e 0a 0a 3c 50 3e | 0a 41 62 6f 76 65 2c 20 |IV>..<P>|.Above, |
|00000fa0| 77 65 20 73 65 65 20 74 | 68 61 74 20 62 6f 74 68 |we see t|hat both|
|00000fb0| 20 70 72 6f 63 65 73 73 | 65 73 20 6e 6f 77 20 68 | process|es now h|
|00000fc0| 61 76 65 20 61 63 63 65 | 73 73 20 74 6f 20 74 68 |ave acce|ss to th|
|00000fd0| 65 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |e file d|escripto|
|00000fe0| 72 73 20 77 68 69 63 68 | 0a 63 6f 6e 73 74 69 74 |rs which|.constit|
|00000ff0| 75 74 65 20 74 68 65 20 | 70 69 70 65 6c 69 6e 65 |ute the |pipeline|
|00001000| 2e 20 20 49 74 20 69 73 | 20 61 74 20 74 68 69 73 |. It is| at this|
|00001010| 20 73 74 61 67 65 2c 20 | 74 68 61 74 20 61 20 63 | stage, |that a c|
|00001020| 72 69 74 69 63 61 6c 20 | 64 65 63 69 73 69 6f 6e |ritical |decision|
|00001030| 20 6d 75 73 74 20 62 65 | 0a 6d 61 64 65 2e 20 20 | must be|.made. |
|00001040| 49 6e 20 77 68 69 63 68 | 20 64 69 72 65 63 74 69 |In which| directi|
|00001050| 6f 6e 20 64 6f 20 77 65 | 20 64 65 73 69 72 65 20 |on do we| desire |
|00001060| 64 61 74 61 20 74 6f 20 | 74 72 61 76 65 6c 3f 20 |data to |travel? |
|00001070| 20 44 6f 65 73 20 74 68 | 65 20 63 68 69 6c 64 20 | Does th|e child |
|00001080| 70 72 6f 63 65 73 73 0a | 73 65 6e 64 20 69 6e 66 |process.|send inf|
|00001090| 6f 72 6d 61 74 69 6f 6e | 20 74 6f 20 74 68 65 20 |ormation| to the |
|000010a0| 70 61 72 65 6e 74 2c 20 | 6f 72 20 76 69 63 65 2d |parent, |or vice-|
|000010b0| 76 65 72 73 61 3f 20 20 | 54 68 65 20 74 77 6f 20 |versa? |The two |
|000010c0| 70 72 6f 63 65 73 73 65 | 73 20 6d 75 74 75 61 6c |processe|s mutual|
|000010d0| 6c 79 20 61 67 72 65 65 | 0a 6f 6e 20 74 68 69 73 |ly agree|.on this|
|000010e0| 20 69 73 73 75 65 2c 20 | 61 6e 64 20 70 72 6f 63 | issue, |and proc|
|000010f0| 65 65 64 20 74 6f 20 60 | 60 63 6c 6f 73 65 27 27 |eed to `|`close''|
|00001100| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 74 68 65 20 | the end| of the |
|00001110| 70 69 70 65 20 74 68 61 | 74 20 74 68 65 79 20 61 |pipe tha|t they a|
|00001120| 72 65 20 6e 6f 74 0a 63 | 6f 6e 63 65 72 6e 65 64 |re not.c|oncerned|
|00001130| 20 77 69 74 68 2e 20 20 | 46 6f 72 20 64 69 73 63 | with. |For disc|
|00001140| 75 73 73 69 6f 6e 20 70 | 75 72 70 6f 73 65 73 2c |ussion p|urposes,|
|00001150| 20 6c 65 74 27 73 20 73 | 61 79 20 74 68 65 20 63 | let's s|ay the c|
|00001160| 68 69 6c 64 20 70 65 72 | 66 6f 72 6d 73 20 73 6f |hild per|forms so|
|00001170| 6d 65 0a 70 72 6f 63 65 | 73 73 69 6e 67 2c 20 61 |me.proce|ssing, a|
|00001180| 6e 64 20 73 65 6e 64 73 | 20 69 6e 66 6f 72 6d 61 |nd sends| informa|
|00001190| 74 69 6f 6e 20 62 61 63 | 6b 20 74 68 72 6f 75 67 |tion bac|k throug|
|000011a0| 68 20 74 68 65 20 70 69 | 70 65 20 74 6f 20 74 68 |h the pi|pe to th|
|000011b0| 65 20 70 61 72 65 6e 74 | 2e 20 20 4f 75 72 0a 6e |e parent|. Our.n|
|000011c0| 65 77 6c 79 20 72 65 76 | 69 73 65 64 20 73 6b 65 |ewly rev|ised ske|
|000011d0| 74 63 68 20 77 6f 75 6c | 64 20 61 70 70 65 61 72 |tch woul|d appear|
|000011e0| 20 61 73 20 73 75 63 68 | 3a 0a 0a 3c 50 3e 0a 3c | as such|:..<P>.<|
|000011f0| 44 49 56 20 63 6c 61 73 | 73 3d 22 43 45 4e 54 45 |DIV clas|s="CENTE|
|00001200| 52 22 3e 0a 0a 0a 3c 42 | 52 3e 0a 3c 49 4d 47 0a |R">...<B|R>.<IMG.|
|00001210| 20 20 53 54 59 4c 45 3d | 22 68 65 69 67 68 74 3a | STYLE=|"height:|
|00001220| 20 31 39 2e 35 38 65 78 | 3b 20 76 65 72 74 69 63 | 19.58ex|; vertic|
|00001230| 61 6c 2d 61 6c 69 67 6e | 3a 20 31 35 39 2e 32 33 |al-align|: 159.23|
|00001240| 65 78 3b 20 22 20 53 52 | 43 3d 22 69 6d 67 34 2e |ex; " SR|C="img4.|
|00001250| 70 6e 67 22 0a 20 41 4c | 54 3d 22 5c 62 65 67 69 |png". AL|T="\begi|
|00001260| 6e 7b 70 69 63 74 75 72 | 65 7d 28 31 30 32 34 2c |n{pictur|e}(1024,|
|00001270| 32 35 34 29 0a 5c 70 75 | 74 28 34 30 36 2c 32 34 |254).\pu|t(406,24|
|00001280| 38 29 7b 5c 72 75 6c 65 | 7b 32 32 34 5c 75 6e 69 |8){\rule|{224\uni|
|00001290| 74 6c 65 6e 67 74 68 7d | 7b 32 5c 75 6e 69 74 6c |tlength}|{2\unitl|
|000012a0| 65 6e 67 74 68 7d 7d 0a | 5c 70 75 2e 2e 2e 0a 2e |ength}}.|\pu.....|
|000012b0| 2e 2e 74 68 7d 7b 32 5c | 75 6e 69 74 6c 65 6e 67 |..th}{2\|unitleng|
|000012c0| 74 68 7d 7d 0a 5c 70 75 | 74 28 32 33 2c 34 29 7b |th}}.\pu|t(23,4){|
|000012d0| 5c 72 75 6c 65 7b 32 32 | 34 5c 75 6e 69 74 6c 65 |\rule{22|4\unitle|
|000012e0| 6e 67 74 68 7d 7b 32 5c | 75 6e 69 74 6c 65 6e 67 |ngth}{2\|unitleng|
|000012f0| 74 68 7d 7d 0a 5c 65 6e | 64 7b 70 69 63 74 75 72 |th}}.\en|d{pictur|
|00001300| 65 7d 22 3e 0a 3c 42 52 | 3e 0a 3c 2f 44 49 56 3e |e}">.<BR|>.</DIV>|
|00001310| 0a 3c 50 3e 0a 3c 44 49 | 56 20 63 6c 61 73 73 3d |.<P>.<DI|V class=|
|00001320| 22 43 45 4e 54 45 52 22 | 3e 0a 3c 2f 44 49 56 3e |"CENTER"|>.</DIV>|
|00001330| 0a 3c 50 3e 0a 3c 44 49 | 56 20 63 6c 61 73 73 3d |.<P>.<DI|V class=|
|00001340| 22 43 45 4e 54 45 52 22 | 3e 0a 3c 2f 44 49 56 3e |"CENTER"|>.</DIV>|
|00001350| 0a 0a 3c 50 3e 0a 43 6f | 6e 73 74 72 75 63 74 69 |..<P>.Co|nstructi|
|00001360| 6f 6e 20 6f 66 20 74 68 | 65 20 70 69 70 65 6c 69 |on of th|e pipeli|
|00001370| 6e 65 20 69 73 20 6e 6f | 77 20 63 6f 6d 70 6c 65 |ne is no|w comple|
|00001380| 74 65 21 20 20 54 68 65 | 20 6f 6e 6c 79 20 74 68 |te! The| only th|
|00001390| 69 6e 67 20 6c 65 66 74 | 20 74 6f 20 64 6f 20 69 |ing left| to do i|
|000013a0| 73 0a 6d 61 6b 65 20 75 | 73 65 20 6f 66 20 74 68 |s.make u|se of th|
|000013b0| 65 20 70 69 70 65 2e 20 | 20 54 6f 20 61 63 63 65 |e pipe. | To acce|
|000013c0| 73 73 20 61 20 70 69 70 | 65 20 64 69 72 65 63 74 |ss a pip|e direct|
|000013d0| 6c 79 2c 20 74 68 65 20 | 73 61 6d 65 20 73 79 73 |ly, the |same sys|
|000013e0| 74 65 6d 20 63 61 6c 6c | 73 20 74 68 61 74 0a 61 |tem call|s that.a|
|000013f0| 72 65 20 75 73 65 64 20 | 66 6f 72 20 6c 6f 77 2d |re used |for low-|
|00001400| 6c 65 76 65 6c 20 66 69 | 6c 65 20 49 2f 4f 20 63 |level fi|le I/O c|
|00001410| 61 6e 20 62 65 20 75 73 | 65 64 20 28 72 65 63 61 |an be us|ed (reca|
|00001420| 6c 6c 20 74 68 61 74 20 | 70 69 70 65 73 20 61 72 |ll that |pipes ar|
|00001430| 65 20 61 63 74 75 61 6c | 6c 79 0a 72 65 70 72 65 |e actual|ly.repre|
|00001440| 73 65 6e 74 65 64 20 69 | 6e 74 65 72 6e 61 6c 6c |sented i|nternall|
|00001450| 79 20 61 73 20 61 20 76 | 61 6c 69 64 20 69 6e 6f |y as a v|alid ino|
|00001460| 64 65 29 2e 0a 0a 3c 50 | 3e 0a 54 6f 20 73 65 6e |de)...<P|>.To sen|
|00001470| 64 20 64 61 74 61 20 74 | 6f 20 74 68 65 20 70 69 |d data t|o the pi|
|00001480| 70 65 2c 20 77 65 20 75 | 73 65 20 74 68 65 20 77 |pe, we u|se the w|
|00001490| 72 69 74 65 28 29 20 73 | 79 73 74 65 6d 20 63 61 |rite() s|ystem ca|
|000014a0| 6c 6c 2c 20 61 6e 64 20 | 74 6f 20 72 65 74 72 69 |ll, and |to retri|
|000014b0| 65 76 65 20 64 61 74 61 | 0a 66 72 6f 6d 20 74 68 |eve data|.from th|
|000014c0| 65 20 70 69 70 65 2c 20 | 77 65 20 75 73 65 20 74 |e pipe, |we use t|
|000014d0| 68 65 20 72 65 61 64 28 | 29 20 73 79 73 74 65 6d |he read(|) system|
|000014e0| 20 63 61 6c 6c 2e 20 20 | 52 65 6d 65 6d 62 65 72 | call. |Remember|
|000014f0| 2c 20 6c 6f 77 2d 6c 65 | 76 65 6c 20 66 69 6c 65 |, low-le|vel file|
|00001500| 20 49 2f 4f 0a 73 79 73 | 74 65 6d 20 63 61 6c 6c | I/O.sys|tem call|
|00001510| 73 20 77 6f 72 6b 20 77 | 69 74 68 20 66 69 6c 65 |s work w|ith file|
|00001520| 20 64 65 73 63 72 69 70 | 74 6f 72 73 21 20 20 48 | descrip|tors! H|
|00001530| 6f 77 65 76 65 72 2c 20 | 6b 65 65 70 20 69 6e 20 |owever, |keep in |
|00001540| 6d 69 6e 64 20 74 68 61 | 74 20 63 65 72 74 61 69 |mind tha|t certai|
|00001550| 6e 0a 73 79 73 74 65 6d | 20 63 61 6c 6c 73 2c 20 |n.system| calls, |
|00001560| 73 75 63 68 20 61 73 20 | 6c 73 65 65 6b 28 29 2c |such as |lseek(),|
|00001570| 20 64 6f 20 6e 6f 74 20 | 77 6f 72 6b 20 77 69 74 | do not |work wit|
|00001580| 68 20 64 65 73 63 72 69 | 70 74 6f 72 73 20 74 6f |h descri|ptors to|
|00001590| 20 70 69 70 65 73 2e 0a | 0a 3c 50 3e 0a 0a 3c 48 | pipes..|.<P>..<H|
|000015a0| 52 3e 0a 0a 3c 2f 42 4f | 44 59 3e 0a 3c 2f 48 54 |R>..</BO|DY>.</HT|
|000015b0| 4d 4c 3e 0a | |ML>. | |
+--------+-------------------------+-------------------------+--------+--------+